 


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.swing.JOptionPane;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;


public class ModifyContactAction extends Action {
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
		final ModifyContactValidationForm lForm = (ModifyContactValidationForm) form;


			
		final String nom = lForm.getNom();
		
		final String prenom = lForm.getPrenom();
		
		final String email = lForm.getEmail();
		
		final String adresse = lForm.getAdresse();
		
		

		// pour cr?er  un nouveau  DAO 
		DAOContact bd = new DAOContact();
		String lError = bd.modifyContact(nom,prenom,email,adresse);


		
		if (lError == null) {
			return mapping.findForward("success");
		} else {
			JOptionPane.showMessageDialog(null,"on a une erreur du dao pour l'ajout en base de donn?es");;
			return mapping.findForward("error");
		}
	}
}